home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GTPLT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  706 b   |  27 lines

  1. /* getpalette */
  2. #include <stdio.h>
  3. #include <graphics.h>
  4.  
  5. main()
  6. {
  7.     int graphdriver = DETECT,graphmode,i;
  8.     struct palettetype cur_palette;
  9.     char buffer[80];
  10.  
  11. /*  Initialize the graphics system */
  12.     initgraph(&graphdriver,&graphmode,"c:\\turboc");
  13.     outtextxy(10,20,"Demonstrating getpalette");
  14. /*  Get current palette and print it out */
  15.     getpalette(&cur_palette);
  16.     sprintf(buffer,"Current palette has %d colors",cur_palette.size);
  17.     outtextxy(10,60,buffer);
  18.     outtextxy(10,70,"The entries are: ");
  19.     moveto(10,80);
  20.     for(i=0;i<cur_palette.size;i++);
  21.     {
  22.         sprintf(buffer,"%2d ",cur_palette.colors[i]);
  23.         outtext(buffer);
  24.     }
  25.     outtextxy(10,270,"Hit any key to exit:");
  26.     closegraph();
  27.     }